{% extends "BluehouseappWebBundle:Frontend/layout:layout.html.twig" %}

{% block body -%}
    <div class="h20"></div>
    <div class="box">
        <div class="box_cell">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody>
                    <tr>
                        <td width="73" valign="top" align="center">
    {% if member.avatar %}
                            <img src="{{vich_uploader_asset(member,'userImage')|imagine_filter('avatar_image')}}" class="box_avatar" border="0" align="default"/>
    {% else %}
        <img src="{{ asset('bundles/bluehouseappweb/images/user_default_large.png') }}"/>

    {% endif %}

                            <div class="box_sep10"></div>
                            {#<strong class="box_online">ONLINE</strong>#}
                        </td>
                        <td width="10"></td>
                        <td width="auto" valign="top" align="left">
                            <div class="box_fr">

                            </div>

                            <h1 style="margin-bottom: 5px;">
                                {% if  member.nickname  %}
                                    {{ member.nickname }}
                                {% else %}
                                    {{ member.username }}

                                {% endif %}
                            </h1>


                            <div class="box_sep10"></div>
                            <span class="box_gray"><li class="box_fa box_fa-time"></li>
                                &nbsp; 加入于

                                {{ time_diff(member.created) }}
                                </span>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div class="box_sep5"></div>
        </div>
        <div class="box_cell">
            {% if  member.website  %}
            <div class="box_sep5"></div>

            <div class="box_icon box_mobileme">
                <a href="{{ member.website }}" target="_blank">
                    {{ member.website }}
                </a>
            </div>
            {% endif %}
                {% if   member.weibo  %}
            <div class="box_sep5"></div>

            <div class="box_icon box_weibo">
                <a href="{{ member.weibo }}" target="_blank">
                    {{ member.weibo }}
                </a>
            </div>
                {% endif %}
                    {% if  member.oschina  %}
            <div class="box_sep5"></div>

            <div class="box_icon box_osChina">
                <a href="{{ member.oschina }}" target="_blank">
                    {{ member.oschina }}
                </a>
            </div>
                    {% endif %}
              {% if   member.city  %}
            <div class="box_sep5"></div>

            <div class="box_icon box_location">
                <a href="#">
                    {{ member.city }}
                </a>
            </div>
              {% endif %}
            <div class="box_sep5"></div>

        </div>
           {% if  member.description  %}
        <div class="box_cell">
            {{ member.description|striptags|raw|nl2br}}
        </div>
           {% endif %}
    </div>

    <div class="box_sep20"></div>

    <div class="box">
        <div class="box_cell">
            {#<div class="box_fr"><img src="/static/img/rss.png" align="absmiddle">&nbsp; <a href="/feed/member/konakona.xml">Atom</a></div>#}
            <span class="box_gray">
                {% if  member.nickname  %}
                    {{ member.nickname }}
                 {% else %}
                    {{ member.username }}
                {% endif %} 最近创建的主题</span></div>

    {% for post in posts %}
        <div class="box_cell box_item" style="border-top-left-radius: 3px; border-top-right-radius: 3px;"><div style="position: absolute; margin: -10px -10px 0px 650px;"></div>
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody><tr>

                    <td width="auto" valign="middle"><span class="box_item_title">
                            <a href="{{ path('post_show', { 'id': post.id }) }}">{{ post.title }}</a>
                        </span>
                        <div class="box_sep5"></div>
                        <span class="box_small box_fade"><div class="box_votes">

                        </div><a class="box_node" href="#"></a> &nbsp;•&nbsp; <strong>
                                <a href="{{ path('user_show', { 'username': post.member.username }) }}">
                                    {% if   post.member.nickname  %}
                                        {{  post.member.nickname }}
                                    {% else %}
                                        {{  post.member.username }}
                                    {% endif %}
                                </a></strong> &nbsp;•&nbsp;
                            {{ time_diff(post.created) }}

        {% if lastComments[post.id] %}
            &nbsp;•&nbsp;
            {% set lastCommentMember= lastComments[post.id].member %}
                            最后回复来自 <strong>
            <a  href="{{ path('user_show', { 'username': lastCommentMember.username }) }}">
                {% if lastCommentMember.nickname %}
                    {{ lastCommentMember.nickname }}
                {% else %}
                    {{ lastCommentMember.username }}
                {% endif %}
            </a>
                                </strong>
        {% endif %}
            </span>
                    </td>
                    <td width="50" align="right" valign="middle">
{% if post.commentCount>0 %}
                        <a href="{{ path('post_show', { 'id': post.id }) }}" class="box_count_livid">{{ post.commentCount }}</a>
{% endif %}
                    </td>
                </tr>
                </tbody></table>
        </div>
        {% endfor %}

        <div class="box_inner"><span class="box_chevron">»</span>
            <a href="{{ path('user_show_topics', { 'username': member.username }) }}">
                {% if member.nickname %}
                    {{ member.nickname }}
                {% else %}
                    {{ member.username }}
                {% endif %}
                创建的更多主题</a></div>

    </div>


    <div class="box_sep20"></div>
    <div class="box">
        <div class="box_cell"><span class="box_gray">
                 {% if  member.nickname  %}
                     {{ member.nickname }}
                 {% else %}
                     {{ member.username }}
                 {% endif %}
                最近回复了</span></div>
    {% for postComment in postComments %}
        <div class="box_dock_area">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody><tr>
                    <td style="padding: 10px 15px 8px 15px; font-size: 12px; text-align: left;"><div class="box_fr"><span class="box_fade">

                                {{ time_diff(postComment.created) }}
                            </span></div>
                        <span class="box_gray">回复了

                            {% if postComment.post.member.nickname %}
                                {{ postComment.post.member.nickname }}
                            {% else %}
                                {{ postComment.post.member.username }}
                            {% endif %}
                            创建的主题 <span class="box_chevron">›</span>
                            <a href="{{path('post_show', { 'id': postComment.post.id }) }}">{{ postComment.post.title }}</a></span></td>
                </tr>
                <tr>
                    <td align="left">
                        <div class="box_feedback"></div>
                    </td>
                </tr>
                </tbody></table>
        </div>
        {% if loop.last %}
         <div class="box_cell">
         {% else %}
             <div class="box_inner">
          {% endif %}
            <div class="box_reply_content">{{ postComment.content|striptags|raw|nl2br }}</div>
        </div>
    {% endfor %}


        <div class="box_inner"><span class="box_chevron">»</span>
            <a href="{{ path('user_show_replies', { 'username': member.username }) }}">
                {% if  member.nickname  %}
                    {{ member.nickname }}
                {% else %}
                    {{ member.username }}
                {% endif %}
                创建的更多回复</a></div>

    </div>

{% endblock %}